<?php
class BbsPdo{

	private static $instance;

    public static function &get_instance() {
        if (!self::$instance) {
            self::$instance = new self();
        }
        return self::$instance;
    }

	private function __construct(){
		$dsn = 'mysql:dbname=forum_db_dy;host=192.168.1.225;port=3306';
		$user = 'caixh';
		$password = 'caixh123';
		$this->dz_pdo = new PDO($dsn, $user, $password);
		$this->dz_pdo->exec('SET CHARACTER SET utf8');
		$this->dz_pdo->exec('SET NAMES utf8');

//		$dsn = 'mysql:dbname=ajk_bbs;host=127.0.0.1;port=3306';
//		$user = 'root';
//		$password = '';
//		$this->bbs_pdo = new PDO($dsn, $user, $password);
//		$this->bbs_pdo->exec('SET CHARACTER SET utf8');
//		$this->bbs_pdo->exec('SET NAMES utf8');

		$dsn = 'mysql:dbname=bbs_db;host=192.168.1.96;port=3306';
		$user = 'ajk_bbs';
		$password = 'f0kox9XH';
		$this->bbs_pdo = new PDO($dsn, $user, $password);
		$this->bbs_pdo->exec('SET CHARACTER SET utf8');
		$this->bbs_pdo->exec('SET NAMES utf8');

		$dsn = 'mysql:dbname=anjuke_db_dy;host=192.168.1.225;port=3306';
		$user = 'caixh';
		$password = 'caixh123';
		$this->ajk_pdo = new PDO($dsn, $user, $password);
		$this->ajk_pdo->exec('SET CHARACTER SET utf8');
		$this->ajk_pdo->exec('SET NAMES utf8');
	}

	public function get_dz_pdo(){
		return $this->dz_pdo;
	}

	public function get_bbs_pdo(){
		return $this->bbs_pdo;
	}

	public function get_ajk_pdo(){
		return $this->ajk_pdo;
	}
}

//$stmt=$pdo->prepare("select * from cdb_forums limit 1");
//$stmt->execute();
//$stmt->setFetchMode(PDO::FETCH_ASSOC);
//print_r($stmt->fetchAll());